import React, { lazy, Suspense } from 'react';
// import logo from './logo.svg';
import './App.css';
// import Index from './view/Index';
import { Route, Switch, Redirect } from 'react-router-dom'
import Loading from './views/Loading';
var Index = lazy(() => import('./views/Index'))
var City = lazy(() => import('./views/City'))
var NotFound = lazy(() => import('./views/NotFound'))
var Search = lazy(() => import('./views/Search/Search'))
var Searchlist = lazy(() => import('./views/Searchlist/Searchlist'))
var Details = lazy(() => import('./views/Details/Details'))
var Login = lazy(() => import('./views/login/Login'))
var Register = lazy(() => import('./views/Register/Register'))
var Order = lazy(() => import('./views/Order/Order'))
var OrderEnd = lazy(() => import('./views/Order/OrderEnd'))
var UserSet = lazy(() => import('./views/UserSet/UserSet'))
var ChangePass = lazy(() => import('./views/UserSet/ChangePass'))
var OrderList = lazy(() => import('./views/Order/OrderList'))
var Address_Add = lazy(() => import('./views/Address/Address_Add'))
var Address_edit = lazy(() => import('./views/Address/Address_edit'))
var Address_List = lazy(() => import('./views/Address/Address_List'))
function App() {
  return (
    <div className="App">
      <Suspense fallback={<Loading />}>
        <Switch>
          <Route path='/index' component={Index} />
          <Route exact path='/city' component={City} />
          <Route exact path='/search' component={Search} />
          <Route exact path='/searchlist' component={Searchlist} />
          <Route exact path='/login' component={Login} />
          <Route exact path='/order/:time' component={Order} />
          <Route exact path='/orderend' component={OrderEnd} />
          <Route exact path='/userset' component={UserSet} />
          <Route exact path='/changepass' component={ChangePass} />
          <Route exact path='/orderlist' component={OrderList} />
          <Route exact path='/addresslist' component={Address_List} />
          <Route exact path='/addressadd' component={Address_Add} />
          <Route exact path='/addressedit' component={Address_edit} />
          <Route path='/register' component={Register} />
          <Route exact path='/details/:proid' component={Details} />
          <Redirect exact from="/" to="/index" />
          <Route path="*" component={NotFound} />
        </Switch>
      </Suspense>
    </div>
  );
}

export default App;
